package com.hsp.homework.homework13;

public class Homework13 {
    public static void main(String[] args) {
        Student student = new Student("小明", "男", 15,"00023102","篮球");
        Student student1 = new Student("大明", "男", 18,"00023101","足球");
//        student.printInfo();
        System.out.println("---------------------------------------");
        Teacher teacher = new Teacher("张飞", "男", 34, 12, "围棋");
        Teacher teacher1 = new Teacher("啊飞", "男", 23, 18, "相棋");
//        teacher.printInfo();

        Person[] p = {student,student1,teacher,teacher1};
        for (int i = 0; i < p.length-1; i++) {
            for (int j = 0; j < p.length-i-1; j++) {
                Person tem = p[j];
                if (p[j].getAge() > p[j + 1].getAge()) {
                    p[j] = p[j + 1];
                    p[j + 1] = tem;
                }
            }
        }
        for (int i = 0; i < p.length; i++) {
            System.out.println(p[i]);
            System.out.println("-------------------------------");
        }


    }
}
